package com.xushi.controller;

import com.xushi.service.AlipayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;

@Controller
@RequestMapping("/pay/alipay/redirect")
public class AlipayController {
    @Autowired
    private AlipayService alipayService;

    @GetMapping("/authRedirect")
    public String authRedirect(HashMap<String, String> params) {
        System.out.println(params.toString());
        return "pay_success";
    }

    @GetMapping("/notify")
    public String notify(HashMap<String, String> params) {
        System.out.println(params.toString());
        alipayService.notify(params);
        return "pay_success";
    }

    @GetMapping("/return")
    public String returnCallback(HashMap<String, String> params) {
        System.out.println(params.toString());
        return "pay_success";
    }
}
